﻿using System;
using System.Text;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using Tssipl.PaymentAdapter.Core;
namespace Tssipl.PaymentAdapter.MessageFormat.Sfms
{
    public class TestSfmsParser  //HACK extends TestCase
    {

        static private String GoodSfmsMessage = "{A:RTGF01O298R42BNKA0000001BNKB0000001211000MURMURMURMURMURM2XXX2004121810152000000000XXXXXXXXXXBNKAH0335000000199}{4:\r\n" +
                ":2020:TRN0000000000001\r\n" +
                ":2006:RRN0000000000001\r\n" +
                ":4488:20030808INR5000,00\r\n" +
                ":5517:BNKA0000001\r\n" +
                ":6717:/C/INFORMATIONFOLLOWINGCODE\r\n" +
                "BRANCHNAME\r\n" +
                ":5526:/C/INFORMATIONFOLLOWINGCODE\r\n" +
                "BRANCHNAME\r\n" +
                "LINE 2\r\n" +
                "LINE 3\r\n" +
                "LINE 4\r\n" +
                ":6521:BNKB0000001\r\n" +
                "-}";


        public void test() //throws Exception
        {

            MessageParseResults results = SfmsMessageParser.parseMessage(GoodSfmsMessage);
            foreach (string error in results.getErrors())
            {
                Console.WriteLine(error);
            }
            //assertNotNull(results.getMessage());

            SfmsMessage message = (SfmsMessage)results.getMessage();
            Console.WriteLine(results.getMessage().ToString());
            ////Assert.AreEqual(message.getBlock1().getBIC12(), "ABCDUS10AXXX");

            ////Assert.AreEqual(message.getBlock1().getBIC11(), "ABCDUS10XXX");
            ////Assert.AreEqual(message.getBlock1().getBIC8(), "ABCDUS10");

            ////SfmsBlock2Inbound block2 = message.getBlock2Inbound();
            ////assertNotNull(block2);
            ////assertNull(message.getBlock2Outbound());

            ////Assert.AreEqual(message.getMT(), "202");

            ////Assert.AreEqual(block2.getBIC12(), "MNOPUS40HXYZ");
            ////Assert.AreEqual(block2.getBIC11(), "MNOPUS40XYZ");
            ////Assert.AreEqual(block2.getBIC8(), "MNOPUS40");

            ////Assert.AreEqual(message.getBlock4().getFields().Count, 6);

            ////Assert.AreEqual(GoodSfmsMT202Message, message.ToString());

            ////Assert.AreEqual(message.getBlock4().getField("20"), "101101012345678A");
            ////Assert.AreEqual(message.getBlock4().getField("21"), "A10112090QQ1-150");
            ////Assert.AreEqual(message.getBlock4().getField("58A"), "QRSTJP90MNO");
        }


    }
}